<?php $this->headStyle()->captureStart();?>
td.icon a {width:180px;height:110px;}
td.icon a img {max-width:180px;min-width:180px;}
<?php $this->headStyle()->captureEnd();?>
<div class="body">
	<table class="list">
		<tr>
			<th colspan="3"><?php echo $this->language('PHOTOS SETTING');?></th>
		</tr>
		<?php
		foreach($this->list AS $key => $row) {
			$locale = isset($this->locale[$row->getId()]) ? $this->locale[$row->getId()] : false;
			$keyword = isset($this->keyword[$row->getId()]) ? $this->keyword[$row->getId()] : array();
		?>
		<tr>
			<td class="icon"><a href="<?php echo $row->getImage()->getLarge(false);?>" target="_blank" style="float:left;"><img src="<?php echo $row->getImage()->getThumb(false);?>" /></a></td>
			<td>
				<table class="form no-border">
					<tr>
						<td style="width:20%;">
							<code><?php echo $this->language('TITLE');?></code>
							<?php echo $this->form()->text('photo[' . $row->getId() . '][title]', ($locale ? $locale->getTitle() : ''), array('size'=>'40', 'maxlength'=>'250', 'rel' => ($locale ? $locale->getTitle() : ''), '_id' => $row->getId()));?>
						</td>
						<td>
							<code><?php echo $this->language('DISPLAY ORDER');?></code>
							<?php echo $this->form()->text('photo[' . $row->getId() . '][display_order]', ($key + 1),array('size'=>'5', 'maxlength'=>'8'));?>
						</td>
					</tr>
					<tr>
						<td>
							<code><?php echo $this->language('DESCRIPTION');?></code>
							<?php echo $this->form()->textarea('photo[' . $row->getId() . '][description]', ($locale ? $locale->getDescription() : ''), array('cols' => '40', 'rows' => '3', 'style' => 'resize:none;'));?>
						</td>
						<td>
							<code><?php echo $this->language('TAGS');?></code>
							<?php echo $this->form()->text('photo[' . $row->getId() . '][tag]', implode(';', $keyword), array('style'=>'width:80%', 'maxlength'=>'50'));?>
							<code><?php echo $this->language('Separate multiple Tags in ";"');?>;</code>
						</td>
					</tr>
				</table>
			</td>
			<?php if($key == 0) { ?>
			<td style="width:25%;" rowspan="<?php echo count($this->list);?>">
				<fieldset style="padding:1px 0;">
					<legend style="margin:0 5px;">&nbsp;&nbsp;<strong><?php echo $this->language('FUNCTIONS');?></strong>&nbsp;&nbsp;</legend>
					<ul class="citem" style="margin:3px 2px 8px 2px;"><?php
						$str = '';
						$str .= '<li><strong>' . $this->language('SET ALL TITLE AS') . '</strong></li>';
						foreach($this->specialList AS $special) {
							$str .= '<li>';
							$str .= '<input type="radio" name="_special_id" id="_special_id-' . $special->getId() . '" value="' . htmlspecialchars($special->getTitle()) . '" onclick="_function.set(' . $special->getId() . ');" />';
							$str .= '<label class="for-checkbox" for="_special_id-' . $special->getId() . '">' . htmlspecialchars($special->getTitle()) . '</label>';
							$str .= '</li>';
						}
						$str .= '<li>';
						$str .= '<input type="radio" name="_special_id" id="_special_id-0" value="0" onclick="_function.set(0);" />';
						$str .= '<label class="for-checkbox" for="_special_id-0">' . $this->language('DEFAULT') . '</label>';
						$str .= '</li>';
						$str .= '<li>';
						$str .= '<input type="radio" name="_special_id" id="_special_id--1" value="-1" onclick="_function.set(-1);" />';
						$str .= '<label class="for-checkbox" for="_special_id--1">' . $this->language('SPECIFIED') . '</label>';
						$str .= '</li>';
						$str .= '<li id="_specified_li" class="hidden">';
						$str .= '<input type="text" name="_specified_text" id="_specified_text" value="" />&nbsp;';
						$str .= '<button type="button" onclick="_function.set(-2);">' . $this->language('SET') . '</button>';
						$str .= '</li>';
						$str .= '<li><hr/></li>';
						$str .= '<li>';
						$str .= '<input type="checkbox" name="_with_sort" id="_with_sort" value="1" checked="checked" />';
						$str .= '<label class="for-checkbox" for="_with_sort">' . $this->language('SET TITLE WITH SORT') . '</label>';
						$str .= '</li>';
						$str .= '<li>';
						$str .= '<input type="checkbox" name="reverse_sort" id="reverse_sort" value="1" onclick="_function.sort();" />';
						$str .= '<label class="for-checkbox" for="reverse_sort">' . $this->language('REVERSE DISPLAY ORDER') . '</label>';
						$str .= '</li>';
						echo $str;
					?></ul>
				</fieldset>
				<br/>
				<button type="submit" name="next" value="<?php echo ($this->step + 1);?>"><?php echo $this->language('CONTINUE');?> »</button>
			</td>
			<?php } ?>
		</tr>
		<?php } ?>
		<tr>
			<th colspan="3"><?php echo $this->language('PHOTOS SETTING');?></th>
		</tr>
	</table>
</div>
<?php $this->headScript()->captureStart();?>
<!--  
var _function = {
	getAllElements: function(s) {
		var t = [];
		$('input[type=text]').each(function(i){
			if($(this).attr('name').indexOf('[' + s + ']') > -1) {
				t.push($(this));
			}
		});
		return t;
	},
	set: function(id) {
		if(id == -1) {
			$('#_specified_li').show();
			$('#_specified_text').focus();
			return false;
		} else if(id != -2) {
			$('#_specified_li').hide();
		}
		var ts = this.getAllElements('title');
		for(var i = 0; i < ts.length; i++) {
			var v = $('#_special_id-' + id).val();
			if(id == 0) {
				v = ts[i].attr('rel');
			}
			if(id == -2) {
				v = $('input#_specified_text').val();
			}			
			if($('#_with_sort').attr('checked')) {
				var s = ts[i].attr('_id');
				v += '(' + $('#photo-' + s + '-display_order').val() + ')';
			}
			ts[i].val(v);
		}
	},
	sort: function() {
		var ts = this.getAllElements('display_order');
		var sc = $('#reverse_sort').attr('checked');
		var k = ts.length;
		for(var i = 0; i < k; i++) {
			var s = sc ? (k - i) : (i + 1);
			ts[i].val(s.toString());
		}
	}
};
-->
<?php $this->headScript()->captureEnd();?>
